package com.tora.timing;

import org.joda.time.DateTimeZone;
import org.joda.time.LocalTime;

public final class MarketSession {
	private final DateTimeZone timeZone;
	private final LocalTime preopenTime;
	private final LocalTime openTime;
	private final LocalTime closeTime;

	private MarketSession(DateTimeZone timeZone, LocalTime preopenTime,
			LocalTime openTime, LocalTime closeTime) {
		this.timeZone = timeZone;
		this.preopenTime = preopenTime;
		this.openTime = openTime;
		this.closeTime = closeTime;
	}

	public static final class MarketSessionBuilder {
		private DateTimeZone timeZone;
		private LocalTime preopenTime;
		private LocalTime openTime;
		private LocalTime closeTime;

		public MarketSession build() {
			return new MarketSession(timeZone, preopenTime, openTime, closeTime);
		}

		public MarketSessionBuilder setTimezone(DateTimeZone timeZone) {
			this.timeZone = timeZone;
			return this;
		}

		public MarketSessionBuilder setPreopen(LocalTime localTime) {
			this.preopenTime = localTime;
			return this;
		}

		public MarketSessionBuilder setOpen(LocalTime localTime) {
			this.openTime = localTime;
			return this;
		}

		public MarketSessionBuilder setClose(LocalTime localTime) {
			this.closeTime = localTime;
			return this;
		}

	}
}
